﻿
using System;
using System.Data;

using DotNetNuke.Framework;

namespace DotNetNuke.Modules.UserDefinedTable
{


  public abstract class DataProvider
  {
    private static DataProvider objProvider;

    static DataProvider()
    {
      CreateProvider();
    }

    protected DataProvider()
    {
    }

    public abstract void AddData(int UserDefinedRowID, int UserDefinedFieldID, string FieldValue);
    public abstract int AddField(int ModuleID, string FieldTitle, int before, string HelpText, bool Required, string FieldType, string Default, bool Visible, bool ShowOnEdit, bool Searchable, bool isPrivateColumn, string inputSettings, string outputSettings, bool NormalizeFlag, string validationRule, string validationMessage, string EditStyle);
    public abstract int AddRow(int ModuleId);

    private static void CreateProvider()
    {
      objProvider = (DataProvider)Reflection.CreateObject("data", "DotNetNuke.Modules.UserDefinedTable", "");
    }

    public abstract void DeleteData(int UserDefinedRowID, int UserDefinedFieldID);
    public abstract void DeleteField(int UserDefinedFieldID);
    public abstract void DeleteRow(int UserDefinedRowID, int ModuleId);
    public abstract void DeleteRows(int ModuleId);
    public abstract void FillDefaultData(int ModuleId, int FieldId, string DefaultValue);
    public abstract IDataReader GetData(int UserDefinedRowID, int UserDefinedFieldID);
    public abstract IDataReader GetField(int UserDefinedFieldId);
    public abstract int GetFieldDataCount(int UserDefinedFieldID);
    public abstract IDataReader GetFields(int ModuleId);
    public abstract int GetMaxFieldSize();
    public abstract IDataReader GetRow(int UserDefinedRowId, int ModuleId);
    public abstract IDataReader GetRows(int ModuleId);

    public static DataProvider Instance()
    {
      return objProvider;
    }

    public abstract void Reset(int ModuleId);
    public abstract void SwapFieldOrder(int FirstUserDefinedFieldId, int SecondUserDefinedFieldId);
    public abstract void UpdateData(int UserDefinedRowID, int UserDefinedFieldID, string FieldValue);
    public abstract void UpdateField(int UserDefinedFieldID, string FieldTitle, string HelpText, bool Required, string FieldType, string Default, bool Visible, bool ShowOnEdit, bool Searchable, bool isPrivateColumn, string inputSettings, string outputSettings, bool NormalizeFlag, string validationRule, string validationMessage, string EditStyle);

  }

}

